home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / Sample Code / Contributed / SpriteWorld / SpriteWorld Files / Utils / SWParticles.h < prev    next >
Encoding:
Text File  |  2000-10-06  |  2.5 KB  |  99 lines  |  [TEXT/CWIE]

  1. ///--------------------------------------------------------------------------------------
  2. //    SWParticles.h
  3. ///--------------------------------------------------------------------------------------
  4.  
  5.  
  6. #ifndef __PARTICLES__
  7. #define __PARTICLES__
  8.  
  9. #ifndef __QUICKDRAW__
  10. #include <QuickDraw.h>
  11. #endif
  12.  
  13. #ifndef __SWCOMMON__
  14. #include <SWCommonHeaders.h>
  15. #endif
  16.  
  17. #ifndef __SPRITEWORLD__
  18. #include <SpriteWorld.h>
  19. #endif
  20.  
  21. #ifndef __SPRITEFRAME__
  22. #include <SpriteFrame.h>
  23. #endif
  24.  
  25. #ifndef __SPRITE__
  26. #include <Sprite.h>
  27. #endif
  28.  
  29. #include <SWFixed.h>
  30.  
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34.  
  35. #if PRAGMA_ALIGN_SUPPORTED
  36. #pragma options align=mac68k
  37. #endif
  38.  
  39.  
  40. ///--------------------------------------------------------------------------------------
  41. //        type definitions
  42. ///--------------------------------------------------------------------------------------
  43.  
  44. typedef struct Particle
  45. {
  46.     short            lifeRemaining;        // How many frames of animation is left for this particle.
  47.                                         // If it is 0 then this particle is not in the animation
  48.     SWFixed            horizLoc;            // Current horizontal position of the particle
  49.     SWFixed            vertLoc;            // Current vertical position of the particle
  50.     SWFixed            oldHorizLoc;        // Horizontal position of particle the previous frame
  51.     SWFixed            oldVertLoc;            // Vertical position of particle the previous frame
  52.     SWFixed            horizSpeed;            // To be used by the user to move the star
  53.     SWFixed            vertSpeed;            // To be used by the user to move the star
  54.     unsigned long    color;                // The particle's color.
  55. } Particle, *ParticlePtr;
  56.  
  57.  
  58. ///--------------------------------------------------------------------------------------
  59. //    Function prototypes
  60. ///--------------------------------------------------------------------------------------
  61.  
  62. SW_FUNC OSErr InitParticles(long NumParticles, SWFixed Gravity);
  63.  
  64. SW_FUNC void ClearParticles( void );
  65.  
  66. SW_FUNC void NewParticle(
  67.     unsigned long color,
  68.     SWFixed    horizLoc,
  69.     SWFixed    vertLoc,
  70.     SWFixed    horizSpeed,
  71.     SWFixed    vertSpeed,
  72.     short lifeRemaining);
  73.     
  74.     
  75. SW_FUNC void EraseParticlesOffscreen( SpriteWorldPtr spriteWorldP );
  76.  
  77. SW_FUNC void EraseParticlesScrollingOffscreen( SpriteWorldPtr spriteWorldP );
  78.  
  79. SW_FUNC void DrawParticlesOffscreen( SpriteWorldPtr spriteWorldP );
  80.  
  81. SW_FUNC void DrawParticlesScrollingOffscreen( SpriteWorldPtr spriteWorldP );
  82.  
  83. SW_FUNC void UpdateParticlesInWindow( SpriteWorldPtr spriteWorldP );
  84.  
  85. SW_FUNC void UpdateParticlesInScrollingWindow( SpriteWorldPtr spriteWorldP );
  86.  
  87. SW_FUNC void MoveParticles( void );
  88.     
  89. #if PRAGMA_ALIGN_SUPPORTED
  90. #pragma options align=reset
  91. #endif
  92.  
  93.  
  94. #ifdef __cplusplus
  95. }
  96. #endif
  97.  
  98. #endif /* __PARTICLES__ */
  99.